<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>导入学生信息</legend>
</fieldset>

<div class="layui-upload-drag" id="upload_student">
    <i class="layui-icon"></i>
    <p>点击上传,或将文件拖拽到此处导入学生信息</p>
</div>



<blockquote class="layui-elem-quote" style="margin-top: 50px;font-size: 15px">
    <i class="layui-icon">&#xe702;&nbsp;小提示:</i>
    <a href="http://cdn.crud4j.top/导入学生信息模板.xlsx">
    导入学生信息模板下载
    </a>
</blockquote>

<script>
    layui.use(['upload','table','layer'], function() {
        var $ = layui.jquery,
            layer = layui.layer,
            upload = layui.upload;

        // 上传毕业设计
        upload.render({
            elem: '#upload_student'
            ,url: '/api/v1/admin/students',
            method:'POST'
            ,accept: 'file'
            ,exts: 'xls|xlsx'
            ,acceptMime:'.xls,.xlsx'
            ,before:function(obj){
                // 上传loading
                layer.load();
            }
            ,done: function(res){
                // 关闭loading
                layer.closeAll('loading');
                if(res.code==0){
                    layer.msg("导入学生数据成功");
                } else{
                    layer.msg("导入学生信息失败")
                }
            }
        });
    });
</script>
